//==============================================================================
#include "Component.h"

using namespace std;

//==============================================================================
ui::Component::Component(int x, int y, int w, int h)
{
	x_coordinate = x;
	y_coordinate = y;
	width = w;
	height = h;
	name = "";
	type = NONE;
}
//------------------------------------------------------------------------------
ui::Component::~Component(void)
{
}
//------------------------------------------------------------------------------
bool ui::Component::isInRange(int x, int y){
	if (((x > this->x_coordinate) && (x < this->x_coordinate + this->width)) && ((y > this->y_coordinate) && ( y < this->y_coordinate + this->height)))
		return true;
	else
		return false;
}
//------------------------------------------------------------------------------
void ui::Component::setXCoordinate(int x)
{
	this->x_coordinate = x;
}
//------------------------------------------------------------------------------
int ui::Component::getXCoordinate(void)
{
	return this->x_coordinate;
}
//------------------------------------------------------------------------------
void ui::Component::setYCoordinate(int y)
{
	this->y_coordinate = y;
}
//------------------------------------------------------------------------------
int ui::Component::getYCoordinate(void)
{
	return this->y_coordinate;
}
//------------------------------------------------------------------------------
void ui::Component::setPosition(int x, int y)
{
	this->x_coordinate = x;
	this->y_coordinate = y;
}
//------------------------------------------------------------------------------
void ui::Component::setSize(int w, int h)
{
   this->width = w;
   this->height = h;
}
//------------------------------------------------------------------------------
void ui::Component::setName(string name)
{
	this->name = name;
}
//------------------------------------------------------------------------------
string ui::Component::getName(void)
{
	return this->name;
}
//------------------------------------------------------------------------------
void ui::Component::setWidth(int width)
{
	this->width = width;
}
//------------------------------------------------------------------------------
int ui::Component::getWidth(void)
{
	return this->width;
}
//------------------------------------------------------------------------------
void ui::Component::setHeight(int height)
{
	this->height = height;
}

//------------------------------------------------------------------------------
int ui::Component::getHeight(void)
{
	return this->height;
}
//------------------------------------------------------------------------------
void ui::Component::setType(COMPONENT_TYPE type)
{
	this->type = type;
}
//------------------------------------------------------------------------------
COMPONENT_TYPE ui::Component::getType(void)
{
	return this->type;
}
//------------------------------------------------------------------------------
bool ui::Component::ocurredInside(int x, int y)
{
	if( x >= getXCoordinate() && x <= (getXCoordinate() + getWidth())
		&&  y >= getYCoordinate() && y <= (getYCoordinate() + getHeight()) )
        return true;

	return false;
}
//==============================================================================